package com.zm.schedule.schedulemgr.task;

import org.apache.log4j.Logger;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.web.context.ContextLoader;

import com.zm.schedule.schedulemgr.service.IScheduleService;


/**
 * @author chenhuaming
 * @Time：2017年5月3日 上午9:58:37
 * @version 1.0
 */
public class ZMJob implements Job {
	private static Logger logger = Logger.getLogger(ZMJob.class);
	private IScheduleService scheduleService;
	@Override
	public void execute(JobExecutionContext context) throws JobExecutionException {
		logger.info("+++++++++++++删除前两天的日志"+"++++++++++++++++++++++++");
		try {
			if(scheduleService==null){
				scheduleService=(IScheduleService) ContextLoader.getCurrentWebApplicationContext().getBean("scheduleService");
			}
			scheduleService.delJobLogFiveDayAgo();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
}
